import { Module } from '@nestjs/common';
import { AppController } from './app.constroller'
import { LoggerService, UserValueService, UseFactory } from './logger.service'
@Module({
    controllers: [
        AppController
    ],
    providers: [
        {
            provide:'SUFFIX',
            useValue:'apiSuffix'
        },
        {
            provide:'LoggerServiceToken',               //这种方式需要处理他的参数，
            useClass:LoggerService
        },
        LoggerService,
        {           //这也是一种定义provider方法
            provide: 'StringToken',     // 这是一个token，也称为标志，或者说令牌，也就是provider的名字
            useValue: new UserValueService('a')
        },
        {
            provide: 'FactoryToken',
            inject:['arg1','arg2'],
            useFactory: (arg1,arg2) => {
                return new UseFactory(arg1,arg2);
            }
        },
        {
            provide: 'FactoryToken2',
            useFactory: () => {
                return new UseFactory();
            }
        },
    ]
})
export class AppModule {

}